package com.paw.hys.sa.config;

import javax.annotation.PostConstruct;

import com.netflix.hystrix.strategy.HystrixPlugins;
import com.paw.hys.sa.interceptor.SthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author lvzihai
 * @date 2022/8/26
 **/
@Configuration
public class WebConfig implements WebMvcConfigurer {

  @Autowired
  SthInterceptor sthInterceptor;

  @PostConstruct
  public void initConfig(){
//    HystrixPlugins.getInstance().registerConcurrencyStrategy(new MyHystrixConcurrencyStrategy());
  }

  @Override
  public void addInterceptors (InterceptorRegistry registry) {
    registry.addInterceptor(sthInterceptor).addPathPatterns("/**");
  }
}
